package nl.Viewer.ViewManager.Controllers;

import nl.Viewer.SerializedObjects.DataObject;
import nl.Viewer.SerializedObjects.Modality;
import nl.Viewer.SerializedObjects.Visualization;
import nl.Viewer.Sessions.ClientSideSession;
import nl.Viewer.ViewManager.Models.DataStores.ImageDataStore;
import nl.Viewer.ViewManager.Views.JOGLBoxOrientationView;
import nl.Viewer.ViewManager.Views.JOGLImageDataObjectAsViewView;
import nl.Viewer.ViewManager.Views.ParameterView.DefaultParameterView;

/**
 * The implementation of the controller capable of displaying three dimensional Paraview renders which have been
 * rendered to PNG images. This view supports rotation/zooming/panning on the client side, which is propagated to the
 * server resulting in a new render
 * 
 * @see GenericController
 * 
 * @author Jeroen Verschuur
 * 
 */

public class ImageAsViewController extends GenericController {
   private static final long serialVersionUID = -1002462025249966454L;

   public ImageAsViewController( Visualization v, Modality modality, ClientSideSession session, String outputType ) {
      super( v, modality, session, outputType );

      // set the renderer (and button bar if needed)
      this.visualizationRenderer = new JOGLImageDataObjectAsViewView( this );
      this.orientationView = new JOGLBoxOrientationView( this );
      this.parameterView =
         new DefaultParameterView( this, new String[] { "CameraPosition", "CameraViewUp", "CameraFocalPoint",
            "CameraViewAngle", "CameraClippingRange", "Zoom", "Elevation", "Azimuth", "Twist", "ViewSize" } );

      super.initializeComponents();
   }

   public void createNewDataStore( DataObject dataObject ) {
      dataModel.createNewDataStore( new ImageDataStore( dataObject ) );
   }

}
